home *** CD-ROM | disk | FTP | other *** search
/ Windows 6-Pak - Disc 4 / Windows 6-Pak (InfoMagic) (Disc 4) (1999).ISO / Text-Chat-Scripts / pp-320m.exe / pp300 / a-wraps.mrc < prev    next >
Encoding:
Text File  |  1998-08-29  |  28.9 KB  |  701 lines

  1. ; -----------------------------------------------------
  2. ; Peace and Protection (by misspai)
  3. ; -----------------------------------------------------
  4. ; Wrappers for default IRC/mIRC
  5. ; commands (included for safety,
  6. ; functional enhancements, and
  7. ; quick-help purposes)
  8. ; -----------------------------------------------------
  9. dns {
  10.   if ($1 == $null) { dns | return }
  11.   if (. !isin $1) { set %.to.dns $_nickglob($1) | .dns %.to.dns }
  12.   else { set %.to.dns $1 | .dns $1 }
  13.   if ($show) {
  14.     set %_showdns %_showdns %.to.dns
  15.     if (. isin $1) echo $colour(other) -si2 *** Looking up  $+ $1
  16.     else echo $colour(other) -si2 *** Looking up host of  $+ %.to.dns
  17.   }
  18. }
  19. notify {
  20.   if ($left($1,1) isin -+) { set %.opt $1 | set %.nick $_nickglob($2) | set %.note $3- }
  21.   else { set %.opt - | set %.nick $_nickglob($1) | set %.note $2- }
  22.   if (%.nick == $null) { notify | return }
  23.   set %.addr $gettok(%.note,1,32)
  24.   if ((@ isin %.addr) || (* isin %.addr) || ($left(%.addr,1) == $)) set %.note $gettok(%.note,2-,32)
  25.   else unset %.addr
  26.   if (s isin %.opt) { notify -s | return }
  27.   if (h isin %.opt) { notify -h | return }
  28.   if (d isin %.opt) {
  29.     if ($address(%.nick,5) == $null) _lookup %.nick 3 notify $remove($remove(%.opt,d),a) %.nick , %.note
  30.     set %.addr $_ppmask(%.nick,3)
  31.   }
  32.   elseif (i isin %.opt) {
  33.     if (* isin %.addr) goto ok
  34.     if ((! isin %.addr) && (@ isin %.addr)) set %.addr $gettok($_ppmask(%.addr,3),1,64) $+ @*
  35.     elseif ($address(%.nick,5) == $null) _lookup %.nick 5 notify %.opt %.nick , %.note
  36.     else set %.addr $gettok($_ppmask(%.nick,3),1,64) $+ @*
  37.   }
  38.   :ok
  39.   if (v isin %.opt) set %.addr $gettok(%.addr,1,36) $+ $chr(36) $+ %pp.net
  40.   if (w isin %.opt) set %.nick + $+ %.nick
  41.   if (r isin %.opt) set %.dopt -r | else set %.dopt -a
  42.   if (q isin %.opt) .notify %.dopt %.nick %.addr %.note
  43.   else notify %.dopt %.nick %.addr %.note
  44.   if (%+nickcolors) _nickcol %.nick $gettok($address(%.nick,5),2,64) $address(%.nick,5)
  45. }
  46. msg if ($2 == $null) _quickhelp /msg | msg $_nickseries(44,$1) $2-
  47. describe if ($2 == $null) _quickhelp /describe | describe $_nickseries(44,$1) $2-
  48. nick {
  49.   if (%.+indns) return
  50.   if ($1 == $null) _quickhelp /nick
  51.   nick $1-
  52.   if ($2 != $null) _dynpop.rot nick 8 $2
  53.   _dynpop.rot nick 8 $1
  54.   if (($me != $1) && (%pp.net != Offline)) { .timer903 off | .timer905 off | .timer906 off | .timer908 off | .timer909 off | .timer910 off | set %self.lag ?? }
  55. }
  56. ame if ($1 == $null) _quickhelp /ame | if ($chan(0) == 0) return | ame $1-
  57. amsg if ($1 == $null) _quickhelp /amsg | amsg $1-
  58. quit {
  59.   if ($server == $null) _error You must be connected before you can quit.
  60.   if ($1 == $null) _pentry quit $+ $_s2p($_finalmsg($replace($_getmsg(misc,quit),&online&,$duration($online)))) Quitting IRC- Enter quit message.
  61.   if ($_vi(everyquit) >= 100) { unset %everyquit | quit Excess Pai }
  62.   else {
  63.     quit $1-
  64.     _timersinc 2 -quithalt
  65.     if (%-quithalt < 2) disps Quit message- $1-
  66.   }
  67. }
  68. whois {
  69.   if ($1 == $null) {
  70.     if (($left($active,1) == @) || ($count($active,$chr(32)) > 0) || ($chan($active) == $active)) _error You must specify a nickname or use this command in a query or chat window.
  71.     .enable #-whoisno | .raw whois $remove($active,=)
  72.   }
  73.   else {
  74.     .enable #-whoisno
  75.     set %.who $_nickseries(44,$_s2c($1-))
  76.     if ((%pp.net == undernet) && (($findtok(%.who,X,44) != $null) || ($findtok(%.who,W,44) != $null))) _error You should not use /whois on X or W $+ . (use /who if needed.)
  77.     if ($1 == $2) { set %.who $_nickglob($1) | .raw whois %.who %.who }
  78.     else .raw whois %.who
  79.   }
  80. }
  81. w whois $1-
  82. who if ($1 == $null) _quickhelp /who | .enable #-whoisno | .raw who $1 $2-
  83. whowas if ($1 == $null) _quickhelp /whowas | .raw whowas $1-
  84. ww whowas $1-
  85. ew {
  86.   if ($1 == $null) {
  87.     if (($left($active,1) == @) || ($count($active,$chr(32)) > 0) || ($chan($active) == $active)) _error You must specify a nickname or use this command in a query or chat window.
  88.     .enable #-whoisno | .raw whois $remove($active,=) $remove($active,=)
  89.   }
  90.   else {
  91.     .enable #-whoisno
  92.     if ((%pp.net == undernet) && (($1 == W) || ($1 == X))) _error You should not use /whois on X or W $+ . (use /who if needed.)
  93.     set %.who $_nickglob($1) | .raw whois %.who %.who
  94.   }
  95. }
  96. query {
  97.   if ($1 == $null) _quickhelp /query
  98.   set %.nnn $_nickglob($1)
  99.   if ($2 == /me) { query %.nnn | _qc %.nnn ACTION $3- | echo $colour(own) -i2 %.nnn * $me $3- }
  100.   else query %.nnn $2-
  101.   set %.nnn $_renlogfile(%.nnn)
  102.   set %.nnn2 $logdir $+ %.nnn
  103.   if ($exists(%.nnn2)) _dynpop.rot log 8 %.nnn
  104. }
  105. q query $1-
  106. names {
  107.   if ($1 == $null) {
  108.     if ($chan($active) != $active) _error You must use this in a channel or specify a target channel.
  109.     .raw names $active
  110.   }
  111.   elseif (* isin $1-) .raw names $1-
  112.   else .raw names $_patch($1-)
  113.   unset %-namec.*
  114.   set %-namec.ppl 0
  115. }
  116. invite {
  117.   if ($2 != $null) {
  118.     if ($_ischan($1)) invite $_nickglob($2) $1
  119.     else invite $_nickglob($1) $_patch($2)
  120.   }
  121.   elseif ($1 == $null) goto nope
  122.   elseif (($chan($active) == $active) && ($_ischan($1) == $false)) invite $_nickglob($1) $active
  123.   elseif (($query($active) == $active) && ($_ischan($1))) invite $active $1
  124.   elseif (($chat($remove($active,=)) == $remove($active,=)) && ($_ischan($1))) invite $remove($active,=) $1
  125.   else {
  126.     :nope
  127.     _error You must give a nickname and channel, or use in a channel and give a nick, or use in a query/chat and give a channel.
  128.   }
  129. }
  130. inv invite $1-
  131. server {
  132.   if ($1 == $null) _pentry server $+  $+ $_s2p(%lastconnect) Enter server to (re)connect to-
  133.   if ((%pp.net != offline) && ($server != $null)) quit server hop
  134.   if (($1 isnum) && ($len($1) == 4) && ($2 == $null)) {
  135.     if ($server == $null) server $gettok(%lastconnect,1,32) $1
  136.     else server $server $1
  137.   }
  138.   else server $1-
  139. }
  140. join if ($1 == $null) _quickhelp /join | .raw join $_patch($1) $2-
  141. j join $1-
  142. jp join $1- | ping $_patch($1)
  143. pj jp $1-
  144. part {
  145.   if ($1 == $null) {
  146.     if ($chan($active) != $active) _error You must use this in a channel or specify a target channel.
  147.     set %.partmsg $_finalmsg($replace($_getmsg(misc,part),&chan&,$_patch($1)))
  148.     .raw part $active : $+ %.partmsg
  149.   }
  150.   else {
  151.     if (($_ischan($1)) || ($gettok($_patch($1),1,44) ischan)) {
  152.       if ($2 == $null) set %.partmsg $_finalmsg($replace($_getmsg(misc,part),&chan&,$_patch($1)))
  153.       else set %.partmsg $2-
  154.       .raw part $_patch($1) : $+ %.partmsg
  155.     }
  156.     else {
  157.       if ($chan($active) != $active) _error You must use this in a channel or specify a target channel.
  158.       .raw part $active : $+ $1-
  159.     }
  160.   }
  161. }
  162. p part $1-
  163. notice {
  164.   if ($2 == $null) _quickhelp /notice
  165.   set %.mn.to $_nickseries(44,$1)
  166.   if (, isin %.mn.to) {
  167.     if ($_numtok(44,%.mn.to) < 6) set %.mn.send $_privn(Mass1,&targets&,%.mn.to,$2-)
  168.     else set %.mn.send $_privn(Mass2,&targets&,$_numtok(44,%.mn.to),$2-)
  169.     echo $colour(own) -ai2 -> %.mn.send
  170.   }
  171.   elseif ($_ischan(%.mn.to)) {
  172.     set %.mn.send $_massmsg(Channel,$1,&ops&,$opnick(%.mn.to,0),$2-)
  173.     if (%.mn.to ischan) echo $colour(own) -i2 $1 -> %.mn.to $+  %.mn.send
  174.     else echo $colour(own) -ai2 -> %.mn.to $+  %.mn.send
  175.   }
  176.   else {
  177.     set %.mn.send $_privn(Private,&nick&,%.mn.to,$_f2s($2-))
  178.     echo $colour(own) -ai2 -> %.mn.to $+  %.mn.send
  179.   }
  180.   _qnotice %.mn.to %.mn.send
  181. }
  182. n notice $1-
  183. chat {
  184.   if ($1 == $null) {
  185.     if ($query($active) == $active) _askyn _chatact DCC Chat with $active $+ ?
  186.     dcc chat
  187.   }
  188.   else dcc chat $_nickglob($1) $2-
  189. }
  190. _chatact dcc chat $active
  191. c chat $1-
  192. send {
  193.   if ($1 == $null) {
  194.     if (($query($active) == $active) || ($chat($remove($active,=)) == $remove($active,=))) dcc send $remove($active,=)
  195.     else dcc send
  196.   }
  197.   else dcc send $_nickglob($1) $2-
  198. }
  199. s send $1-
  200. motd set %-+motd.request $true | motd $1-
  201. ports .raw stats l
  202. ; -----------------------------------------------------
  203. ; Color/talker identifiers- For
  204. ; internal use, but also for use by
  205. ; users if needed.
  206. ; -----------------------------------------------------
  207. colori _pat.rand 02.03.04.05.06.07.09.10.12.13 $1- | return $result
  208. color2i _pat.rand 01.02.03.04.05.06.07.09.10.12.13.14.15 $1- | return $result
  209. funkyi _pat.rand 02.03.04.05.06.07.09.10.12.13.02.03.04.05.06.07.09.10.12.13.02.03.04.05.06.07.09.10.12.13 $1- | return $result
  210. pati _pattern $replace($gettok(21.22.18.10.19.23~0`17.15`14.14`15.1`16.14`15.15`14~5`17.4`17.7`17.8`17.7`17.4`17~1`24.8`17~8`21.8`22.8`18.8`10.8`19.8`23~...~18.10.19.25.15.25.19.10~1...~8/17.7/17.4/17.5/17.4/17.7/17~0`2-.0`12-.0`10-.0`11-.0`10-.0`12-,$1,126),`,$chr(44)) $2- | if ($1 == 4) return  $+ $result | else return $result
  211. checkeri {
  212.   set %.ch.pats 01-02-03-04-05-06-10-12-13-14,00-04-07-08-09-10-11-13-14-15,00-03-04-07-08-09-10-11-13-15,00-01-02-05-06-08-09-11-12-15,00-01-02-05-06-08-09-11-12-15,00-03-04-07-08-09-10-11-13-15,00-01-02-04-07-08-09-11-13-15,00-01-02-05-06-08-09-11-12-15,01-02-03-04-05-06-10-12-13-14,01-02-03-04-05-06-10-12-13-14,00-01-02-05-06-08-09-11-12-15,01-02-03-04-05-06-10-12-13-14,00-01-02-05-07-08-09-11-13-15,00-01-02-05-06-08-09-11-12-15,00-01-02-05-06-08-09-11-12-15,01-02-03-04-05-06-10-12-13-14
  213.   set %.ch.bk.a 0 $+ $r(0,15)
  214.   set %.ch.bk.a $left(%.ch.bk.a,2)
  215.   :bk.b
  216.   set %.ch.bk.b 0 $+ $r(0,15)
  217.   set %.ch.bk.b $left(%.ch.bk.b,2)
  218.   if (%.ch.bk.b == %.ch.bk.a) goto bk.b
  219.   set %.ch.fg.a $gettok($gettok(%.ch.pats,$_i(%.ch.bk.a),44),$r(1,10),45)
  220.   :fg.b
  221.   set %.ch.fg.b $gettok($gettok(%.ch.pats,$_i(%.ch.bk.b),44),$r(1,10),45)
  222.   if (%.ch.fg.b == %.ch.fg.a) goto fg.b
  223.   set %.ch.col  $+ %.ch.fg.a $+ , $+ %.ch.bk.a $+ . $+ %.ch.fg.b $+ , $+ %.ch.bk.b
  224.   _pattern %.ch.col $1-
  225.   return $result
  226. }
  227. checker2i return  $+ $checkeri($1-) $+ 
  228. ulinei _pat.rand .$ $1- | if (2 // $count($result,)) return $result | return $result $+ 
  229. boldi _pat.rand .$ $1- | if (2 // $count($result,)) return $result | return $result $+ 
  230. codei _pat.rand ...$ $1- | unset %.cdi | if (2 \\ $count($result,)) set %.cdi %.cdi $+  | if (2 \\ $count($result,)) set %.cdi %.cdi $+  | return $result $+ %.cdi
  231. uvoweli return $replace($replace($replace($replace($replace($replace($lower($1-),a,A),e,E),i,I),o,O),u,U),y,Y)
  232. lvoweli return $replace($replace($replace($replace($replace($replace($upper($1-),A,a),E,e),I,i),O,o),U,u),Y,y)
  233. asciii {
  234.   set %.ha.pats Aa└α┴ß┬Γ├π─Σ┼σ b▀ cCó╟⌐τ d╨≡ Ee╚Φ╔Θ╩Ω╦δ âF gG hH iI╠∞═φ╬ε╧∩í jJ kK Lúª mM N±╤ ╥≥╙≤╘⌠╒⌡╓÷╪°Oo p▐■╢ qQ «rR ºèÜs$ åT ┘∙┌█·√ⁿ▄╡Uu vV wW ╫X Ñ ƒy zZ
  235.   set %.ha.str $lower($replace($1-,$chr(32),Å))
  236.   set %.ha.len $len(%.ha.str)
  237.   set %.ha.pos 1
  238.   unset %.ha.fin
  239.   :loop
  240.   set %.ha.chr $mid(%.ha.str,%.ha.pos,1)
  241.   if ($asc(%.ha.chr) isnum 97-122) {
  242.     set %.ha.tok $gettok(%.ha.pats,$calc($asc(%.ha.chr) - 96),32)
  243.     set %.ha.chr $mid(%.ha.tok,$r(1,$len(%.ha.tok)),1)
  244.   }
  245.   set %.ha.fin %.ha.fin $+ %.ha.chr
  246.   if ($_vi(.ha.pos) <= %.ha.len) goto loop
  247.   return $replace(%.ha.fin,Å,$chr(32))
  248. }
  249. initcapi {
  250.   set %.ic.num $_numtok(32,$1-)
  251.   set %.ic.cur 1 | unset %.ic.ret
  252.   :loop
  253.   set %.ic.word $gettok($1-,%.ic.cur,32)
  254.   set %.ic.ret %.ic.ret $upper($left(%.ic.word,1)) $+ $lower($_rchop(1,%.ic.word))
  255.   if ($_vi(.ic.cur) <= %.ic.num) goto loop
  256.   return %.ic.ret
  257. }
  258. backwardsi {
  259.   set %.bw.str $replace($1-,$chr(32),Å)
  260.   set %.bw.len $len($1-) | unset %.bw.ret
  261.   :loop
  262.   set %.bw.ret %.bw.ret $+ $mid(%.bw.str,%.bw.len,1)
  263.   if ($_vd(.bw.len) > 0) goto loop
  264.   return $replace(%.bw.ret,Å,$chr(32))
  265. }
  266. backwordsi {
  267.   set %.bw.num $_numtok(32,$1-)
  268.   unset %.bw.ret
  269.   :loop
  270.   set %.bw.ret %.bw.ret $gettok($1-,%.bw.num,32)
  271.   if ($_vd(.bw.num) > 0) goto loop
  272.   return %.bw.ret
  273. }
  274. randcapi {
  275.   set %.rc.str $replace($1-,$chr(32),Å)
  276.   set %.rc.len $len($1-) | set %.rc.cur 1 | unset %.rc.ret
  277.   :loop
  278.   if ($r(1,2) == 1) set %.rc.ret %.rc.ret $+ $upper($mid(%.rc.str,%.rc.cur,1))
  279.   else set %.rc.ret %.rc.ret $+ $lower($mid(%.rc.str,%.rc.cur,1))
  280.   if ($_vi(.rc.cur) <= %.rc.len) goto loop
  281.   return $replace(%.rc.ret,Å,$chr(32))
  282. }
  283. altcapi {
  284.   set %.rc.str $replace($1-,$chr(32),Å)
  285.   set %.rc.len $len($1-) | set %.rc.cur 1 | set %.rc.up $true unset %.rc.ret
  286.   :loop
  287.   if (%.rc.up) set %.rc.ret %.rc.ret $+ $upper($mid(%.rc.str,%.rc.cur,1))
  288.   else set %.rc.ret %.rc.ret $+ $lower($mid(%.rc.str,%.rc.cur,1))
  289.   set %.rc.up $_not(%.rc.up)
  290.   if ($_vi(.rc.cur) <= %.rc.len) goto loop
  291.   return $replace(%.rc.ret,Å,$chr(32))
  292. }
  293. echoi {
  294.   set %.ec.str $replace($2-,$chr(32),Å)
  295.   set %.ec.len $len($2-) | set %.ec.cur 1 | unset %.ec.ret
  296.   set %.ec.toks $_numtok(46,$1)
  297.   :loop
  298.   set %.ec.chr $mid(%.ec.str,%.ec.cur,1)
  299.   set %.ec.tok 1
  300.   :loop2
  301.   set %.ec.ret %.ec.ret $+ $gettok($1,%.ec.tok,46) $+ %.ec.chr
  302.   if ($_vi(.ec.tok) <= %.ec.toks) goto loop2
  303.   if ($_vi(.ec.cur) <= %.ec.len) goto loop
  304.   return $replace(%.ec.ret,Å,$chr(32))
  305. }
  306. fadei {
  307.   set %.fd.toks $_numtok(46,$1)
  308.   set %.fd.len $len($2-)  
  309.   set %.fd.str $replace($2-,$chr(32),Å)
  310.   set %.fd.secl $int($calc(%.fd.len / %.fd.toks))
  311.   set %.fd.xtra $calc(%.fd.len % %.fd.toks)
  312.   set %.fd.tok 1
  313.   unset %.fd.ret
  314.   :loop
  315.   set %.fd.ret %.fd.ret $+ $gettok($1,%.fd.tok,46) $+ $left(%.fd.str,%.fd.secl)
  316.   set %.fd.str $_rchop(%.fd.secl,%.fd.str)
  317.   if (%.fd.xtra > 0) { set %.fd.ret %.fd.ret $+ $left(%.fd.str,1) | set %.fd.str $_rchop(1,%.fd.str) | dec %.fd.xtra }
  318.   if ($_vi(.fd.tok) <= %.fd.toks) goto loop
  319.   return $replace(%.fd.ret,Å,$chr(32))
  320. }
  321. randomi return $read -n $_adddir($1-)
  322. % return % [ $+ [ $1 ] ]
  323. ; -----------------------------------------------------
  324. ; Setting and viewing channel
  325. ; modes and topics
  326. ; -----------------------------------------------------
  327. mode {
  328.   if ($1 == $me) umode $2-
  329.   else {
  330.     _psplit mm $replace($1-,+,)
  331.     if ((%.mm.param != $null) && (%.mm.param != b) && (%.mm.param != b) && ($me !isop %.mm.chan)) _needops2 %.mm.chan change the mode
  332.     .raw mode $replace(%.mm.chan,,+) $replace(%.mm.param,,+)
  333.     if (k isin %.mm.param) .timer923 1 8 _chkkey $replace(%.mm.chan,,+)
  334.   }
  335. }
  336. m mode $1-
  337. umode .raw mode $me $1-
  338. topic {
  339.   _psplit tt $1-
  340.   if (%.tt.param == $null) { .raw topic %.tt.chan | halt }
  341.   elseif (t !isin $chan(%.tt.chan).mode) goto topicok
  342.   _usexw %.tt.chan changethetopic topic
  343.   if (%.xw != $null) {
  344.     dispr %.tt.chan Using %col.target $+ %.xw $+  to change topic on %col.target $+ %.tt.chan $+ ...
  345.     if (%.xw isin X.W) _privmsg %.xw topic %.tt.chan %.tt.param
  346.     else _botcmd %.xw %.tt.chan $me %.tt.param
  347.   }
  348.   else {
  349.     :topicok
  350.     .raw topic %.tt.chan : $+ %.tt.param
  351.   }
  352. }
  353. t topic $1-
  354. etopic _psplit tt $1- | set %_arhelp t %.tt.chan | _pentry _arhelp $+ $_s2p($chan(%.tt.chan).topic) New topic?
  355. mod m $1 +m
  356. dmod m $1 -m
  357. demod m $1 -m
  358. ; -----------------------------------------------------
  359. ; Displaying P&P version
  360. ; -----------------------------------------------------
  361. myver if (%pp.addon != $null) me is using %[ $+ Peace and Protection %pp.ver by misspai $+ %] with addons: %pp.addon | else me is using %[ $+ Peace and Protection %pp.ver by misspai $+ %] | me - If you want a copy, get it at http://pairc.com/pnp/
  362. p&p myver
  363. ; -----------------------------------------------------
  364. ; Patch support
  365. ; -----------------------------------------------------
  366. patches patch
  367. patch {
  368.   set %.fz.pver $remove($gettok(%pp.ver,1-2,46),v)
  369.   window -c @Patches
  370.   window -nl @Patches @Patches %font.basic
  371.   _progress.1 Scanning $iif($1,$1 drive,all HDs) for P&P %pp.ver patches...
  372.   _progress.2 0 0% complete... (drive $iif($1,$1,C:) $+ )
  373.   set %.fz.dr $iif($1,$asc($1),99) | unset %.fz.found
  374.   :loop1
  375.   set %.fz.wh $chr(%.fz.dr) $+ :\
  376.   inc %.fz.found $findfile(%.fz.wh,*.ppp,@Patches)
  377.   if (($1 == $null) && ($_vi(.fz.dr) <= 122)) {
  378.     set %.fz.perc $int($calc((%.fz.dr - 99) * 100 / 24))
  379.     _progress.2 %.fz.perc %.fz.perc $+ % complete... (drive $upper($chr(%.fz.dr)) $+ :)
  380.     goto loop1
  381.   }
  382.   set %.fz.num $line(@Patches,0)
  383.   if (%.fz.num > 0) {
  384.     :loop2
  385.     set %.fz.ini $line(@Patches,%.fz.num)
  386.     set %.fz.name $readini -n %.fz.ini info name
  387.     set %.fz.ver $readini -n %.fz.ini info ver
  388.     if ((%.fz.ver != %.fz.pver) || (%.fz.name == $null)) { dec %.fz.found | dline @Patches %.fz.num }
  389.     else rline @Patches %.fz.num Patch: %col.dark $+ %.fz.name $+  $chr(160) ( $+ $shortfn(%.fz.ini) $+ )
  390.     if ($_vd(.fz.num) > 0) goto loop2
  391.     set %.fz.num $line(@Patches,0)
  392.   }
  393.   if (%.fz.num < 1) { window -c @Progress | window -c @Patches | _error No patch files found. }
  394.   window -c @Progress
  395.   iline @Patches 1 - Please double-click on the patch file you wish to install -
  396.   iline @Patches 2 %col.att $+ WARNING: ONLY install patches you got from a verifiable source, such as the
  397.   iline @Patches 3 Peace and Protection website. If you do not trust the source, do not install the patch!
  398.   iline @Patches 4 $chr(160)
  399.   set %.wz.hi $int($calc($_rtok(1,32,%font.basic) * 1.6 * (6 + %.fz.found)))
  400.   if (%.wz.hi > $window(-3).h) %.wz.hi = $window(-3).h
  401.   window -ar @Patches $_center($calc( [ $window(-3).w ] - 100),%.wz.hi) $calc( [ $window(-3).w ] - 100) %.wz.hi
  402.   halt
  403. }
  404. _dopatch {
  405.   if ($sline(@Patches,1).ln < 5) halt
  406.   set %.patch $sline(@Patches,1)
  407.   set %.file $_wrapfile($_lchop(1,$_rchop(1,$_rtok(1,32,%.patch))))
  408.   set %.name $gettok(%.patch,2-,32)
  409.   set %.code $readini %.file info code
  410.   if (%.code isin %pp.ver) _error This patch has already been installed.
  411.   _progress.1 Installing patch: %.name
  412.   _progress.2 0 Preparing patch-loader...
  413.     window -n @Patches
  414.   .timer900 off
  415.   _timer924off
  416.   .load -a pp300\a-patch.mrc
  417.   _dopatch2 %.code %.file | halt
  418. }
  419. _pabort2 {
  420.   .unload -a pp300\a-patch.mrc
  421.   window -c @Progress
  422.   _timer924on
  423.   .timer900 0 1 _updtitle
  424.   _gen-icf
  425.   _error Patch aborted- $1- | halt
  426. }
  427. _pfinish {
  428.   .unload -a pp300\a-patch.mrc
  429.   _progress.2 100 Patch complete!
  430.   _timer924on
  431.   .timer900 0 1 _updtitle
  432.   _gen-icf
  433.   window -r @Patches | halt
  434. }
  435. _gen-icf {
  436.   _writecfg Misc Integrity1 $alias(0) | _writecfg Misc Integrity2 $script(0)
  437. }
  438. ; -----------------------------------------------------
  439. ; Addon support
  440. ; -----------------------------------------------------
  441. addons addon
  442. addon {
  443.   window -c @Addons
  444.   window -l @Addons $_winpos(14%,7%,8%,8%) @Addons %font.basic
  445.   set %.fz.num $findfile($mircdir,*.ppa,@Addons)
  446.   if (%.fz.num > 0) {
  447.     :loop2
  448.     set %.fz.ini $_wrapfile($line(@Addons,%.fz.num))
  449.     set %.fz.name $readini -n %.fz.ini addon name
  450.     set %.fz.id $readini -n %.fz.ini addon id
  451.     set %.fz.fn1 $readini -n %.fz.ini files 1
  452.     if ((%.fz.name == $null) || (%.fz.id == $null) || (%.fz.fn1 == $null) || ($findtok(%pp.addon.ids,%.fz.id,32) != $null)) dline @Addons %.fz.num
  453.     else rline @Addons %.fz.num $chr(160) %col.att $+ + %col.dark $+ %.fz.name $+  $chr(160) ( $+ %.fz.ini $+ )
  454.     if ($_vd(.fz.num) > 0) goto loop2
  455.     set %.fz.num $line(@Addons,0)
  456.   }
  457.   iline @Addons 1 - Please double-click on the addon file you wish to install or uninstall -
  458.   iline @Addons 2 %col.att $+ WARNING: Only install addons you got from a reliable source, such as the Peace and Protection website
  459.   iline @Addons 3 or a reputable scripting site. Addons must be in the mIRC directory or a subdirectory to be found.
  460.   iline @Addons 4 $chr(160)
  461.   iline @Addons 5 Addon files- (double-click for info and to install)
  462.   if (%.fz.num < 1) aline @Addons $chr(160) (no new addons found to install)
  463.   aline @Addons $chr(160)
  464.   aline @Addons Addons already installed- (double-click for info and options)
  465.   set %.fz.num $_numtok(32,%pp.addon.ids)
  466.   if (%.fz.num < 1) aline @Addons $chr(160) (no addons currently installed)
  467.   else {
  468.     :loop3
  469.     set %.fz.addon $gettok(%pp.addon.ids,%.fz.num,32)
  470.     set %.fz.ini %addon. [ $+ [ %.fz.addon ] ]
  471.     set %.fz.name $readini -n $_adddir(%.fz.ini) addon name
  472.     if (%.fz.name != $null) aline @Addons $chr(160) %col.att $+ - %col.dark $+ %.fz.name $+  $chr(160) ( $+ $_adddir(%.fz.ini) $+ )
  473.     if ($_vd(.fz.num) > 0) goto loop3
  474.   }
  475.   window -b @Addons
  476. }
  477. _doaddon {
  478.   window -c @Addon
  479.   set %.line $sline(@Addons,1)
  480.   set %.type $strip($gettok(%.line,2,32))
  481.   if (%.type !isin -+) halt
  482.   set %.file $_wrapfile($_lchop(1,$_rchop(1,$_rtok(1,32,%.line))))
  483.   window -l $_tabscale(6) @Addon $_winpos(15%,8%,9%,9%) @Addon %font.basic
  484.   if (%.type == -) {
  485.     titlebar @Addon options ( $+ %.file $+ )
  486.     aline @Addon - Double-click here to configure addon -
  487.     aline @Addon - Double-click here for help on addon -
  488.     aline @Addon - Double-click here to uninstall addon -
  489.   }
  490.   else {
  491.     set %.ppver $readini -n %.file addon ppver
  492.     set %.fz.pver $remove($gettok(%pp.ver,1-2,46),v)
  493.     if (%.ppver > %.fz.pver) { window -c @Addon | _error This addon requires P&P version %.ppver or later (you have %.fz.pver $+ ) }
  494.     titlebar @Addon installation ( $+ %.file $+ )
  495.     aline @Addon - Double-click here to install addon -
  496.   }
  497.   aline @Addon $chr(160)
  498.   set %.name $readini -n %.file addon name
  499.   set %.author $readini -n %.file addon author
  500.   set %.ver $readini -n %.file addon version
  501.   set %.url $readini -n %.file addon url
  502.   set %.email $readini -n %.file addon email
  503.   aline @Addon Name:     $+ %col.info1 $+ %.name
  504.   if (%.ver != $null) aline @Addon Version:     $+ %col.info1 $+ %.ver
  505.   if (%.author != $null) aline @Addon Author:     $+ %col.info1 $+ %.author
  506.   if (%.email != $null) aline @Addon E-Mail:     $+ %col.info1 $+ %.email
  507.   if (%.url != $null) aline @Addon URL:     $+ %col.info1 $+ %.url
  508.   set %.notes $readini -n %.file notes 1
  509.   if (%.notes != $null) {
  510.     aline @Addon $chr(160)
  511.     aline @Addon  Notes 
  512.     aline @Addon %.notes
  513.     set %.num 2
  514.     :loop2
  515.     set %.notes $readini -n %.file notes %.num
  516.     if (%.notes != $null) { aline @Addon %.notes | inc %.num | goto loop2 }
  517.   }
  518.   aline @Addon $chr(160)
  519.   aline @Addon  Files 
  520.   set %.num 1
  521.   :loop3
  522.   set %.notes $readini -n %.file files %.num
  523.   if (%.notes != $null) { aline @Addon %.notes | inc %.num | goto loop3 }
  524.   halt
  525. }
  526. _doaddon2 {
  527.   if ($sline(@Addon,1).ln > 3) halt
  528.   set %.opt $strip($gettok($sline(@Addon,1),5,32))
  529.   set %.file $_wrapfile($_lchop(1,$_rchop(1,$gettok($window(@Addon).titlebar,2,32))))
  530.   if (%.opt == Install) {
  531.     unset %.pcurr
  532.     _progress.1 Installing addon...
  533.     _progress.2 0 Loading addon files...
  534.     set %.num 1
  535.     :loop1
  536.     set %.fn $readini -n %.file files %.num
  537.     if (%.fn == $null) goto nextpart1
  538.     set %.fn2 $findfile($nofile(%.file),%.fn,1)
  539.     if (%.fn2 == $null) { window -c @Progress | _error File " $+ %.fn $+ " not found (required for installation) }
  540.     .load -rs %.fn2
  541.     inc %.num
  542.     goto loop1
  543.     :nextpart1
  544.     _da3prog | .unload -rs pp300\r-misc.mrc
  545.     _da3prog | .unload -rs pp300\r-flood.mrc
  546.     _da3prog | .unload -rs pp300\r-reply.mrc
  547.     _da3prog | .unload -rs pp300\r-disp.mrc
  548.     _da3prog | .unload -rs pp300\r-whois.mrc
  549.     _da3prog | .unload -rs pp300\a-fkeys.mrc
  550.     _da4prog | .load -rs $_ppdir $+ r-misc.mrc
  551.     _da4prog | .load -rs $_ppdir $+ r-disp.mrc
  552.     _da4prog | .load -rs $_ppdir $+ r-flood.mrc
  553.     _da4prog | .load -rs $_ppdir $+ r-reply.mrc
  554.     _da4prog | .load -rs $_ppdir $+ r-whois.mrc
  555.     _da4prog | .load -rs $_ppdir $+ a-fkeys.mrc
  556.     _da2prog Updating integrity files...
  557.     _gen-icf
  558.     _progress.2 100 Install complete!
  559.     set %.id $readini -n %.file addon id
  560.     set %addon. [ $+ [ %.id ] ] $remove(%.file,$mircdir)
  561.     set %pp.addon.ids %pp.addon.ids %.id
  562.     set %.code $readini -n %.file addon code
  563.     if (%.code != $null) set %pp.addon %pp.addon %.code
  564.     set %.config $readini -n %.file addon config
  565.     window -c @Progress
  566.     window -c @Addon
  567.     if ($_isopen(@Addons)) addon
  568.     if (%.config != $null) %.config
  569.   }
  570.   elseif (%.opt == Configure) {
  571.     set %.config $readini -n %.file addon config
  572.     if (%.config == $null) _error This addon does not have any configuration.
  573.     else %.config
  574.   }
  575.   elseif (%.opt == Help) {
  576.     set %.config $readini -n %.file addon help
  577.     if (%.config == $null) _error This addon does not have any defined help.
  578.     else %.config
  579.   }
  580.   elseif (%.opt == Uninstall) {
  581.     _progress.1 Uninstalling addon...
  582.     _progress.2 0 Performing addon cleanup...
  583.     set %.unload $readini -n %.file addon unload
  584.     set %.unset $readini -n %.file addon vars
  585.     set %.unini $readini -n %.file addon ini
  586.     if (%.unload != $null) %.unload
  587.     if (%.unset != $null) {
  588.       set %.unset $_rchop(1,%.unset)
  589.       [ unset % $+ [ %.unset ] ]
  590.     }
  591.     if (%.unini != $null) _remcfg %.unini
  592.     _progress.2 25 Unloading addon files...
  593.     set %.num 1
  594.     :loop2
  595.     set %.fn $readini -n %.file files %.num
  596.     if (%.fn == $null) goto nextpart2
  597.     .unload -rs $script(%.fn)
  598.     inc %.num | goto loop2
  599.     :nextpart2
  600.     _progress.2 50 Updating integrity files...
  601.     _gen-icf
  602.     _progress.2 75 Updating addon info...
  603.     set %.id $readini -n %.file addon id
  604.     set %addon. [ $+ [ %.id ] ]
  605.     set %pp.addon.ids $remtok(%pp.addon.ids,%.id,32)
  606.     set %.code $readini -n %.file addon code
  607.     if (%.code != $null) set %pp.addon $remtok(%pp.addon,%.code,32)
  608.     _progress.2 100 Uninstall complete!
  609.     window -c @Addon
  610.     if ($_isopen(@Addons)) addon
  611.     .timer 1 10 _gen-icf
  612.   }
  613. }
  614. _da4prog _da2prog Reloading P&P scripts in proper order...
  615. _da3prog _da2prog Unloading P&P scripts...
  616. _da2prog inc %.pcurr | set %.perc $int($calc(%.pcurr * 100 / 14)) | _progress.2 %.perc $1-
  617. ; -----------------------------------------------------
  618. ; General editor/edit commands
  619. ; -----------------------------------------------------
  620. edit {
  621.   if ((. isin $1) || (\ isin $1) || (" isin $1)) { run $_ppcfg(Misc,TextView) $1- | .timer 1 10 _recfile2 $_adddir($1-) }
  622.   elseif ($1 == $null) run $_ppcfg(Misc,TextView)
  623.   elseif (p isin $1) protedit $2-
  624.   elseif (c isin $1) config $2-
  625.   elseif (b isin $1) blackedit $2-
  626.   elseif (u isin $1) useredit $2-
  627.   elseif (n isin $1) { run notepad $2- | .timer 1 10 _recfile2 $_adddir($2-) }
  628.   elseif (w isin $1) { run wordpad $2- | .timer 1 10 _recfile2 $_adddir($2-) }
  629.   elseif (l isin $1) viewlog $2-
  630.   elseif ((r isin $1) || (g isin $1)) rec e
  631.   else { run $_ppcfg(Misc,TextView) $1- | if ($1 != $null) .timer 1 10 _recfile2 $_adddir($1-) }
  632. }
  633. vlog viewlog $1-
  634. viewlog {
  635.   if ($1 == $null) set %.aeris $gettok($active,1,32) | else set %.aeris $_nickglob($1)
  636.   if ($left(%.aeris,1) isin =@) set %.aeris $_rchop(1,%.aeris)
  637.   set %.aeris $_renlogfile(%.aeris)
  638.   edit $logdir $+ %.aeris
  639. }
  640. dellog {
  641.   if ($1 == $null) set %.aeris $gettok($active,1,32) | else set %.aeris $_nickglob($1)
  642.   if ($left(%.aeris,1) isin =@) set %.aeris $_rchop(1,%.aeris)
  643.   set %.aeris $_renlogfile(%.aeris)
  644.   remove $logdir $+ %.aeris
  645. }
  646. savelog {
  647.   if (($chr(32) isin $active) || (@ isin $active)) _error This command is meant only for channels or private chat windows
  648.   set %.aeris $active
  649.   if ($left(%.aeris,1) == =) set %.aeris $_rchop(1,%.aeris)
  650.   set %.aeris $logdir $+ $_renlogfile(%.aeris)
  651.   savebuf -a $active %.aeris | log on | dispa Buffer saved and logging initiated at $fulldate
  652. }
  653. rec {
  654.   if (e isin $1) set %.cmd edit
  655.   elseif (p isin $1) set %.cmd sound
  656.   else set %.cmd run
  657. set %.file $_ppcfg(Gets,$_ppcfg(Gets,Num))
  658. if (%.file == $null) _error No file received to run!
  659.   %.cmd %.file $2-
  660. }
  661. recent rec $1-
  662. got rec $1-
  663. pp run peacepro.hlp | _recfile2 $_mircdir $+ peacepro.hlp
  664. notes set %.notefile notes.txt | if ($_not($exists(%.notefile))) { write %.notefile Notes | write %.notefile ----- } | edit notes.txt | _recfile2 %.notefile
  665. help {
  666.   if ($1 == !) winhelp peacepro.hlp $2-
  667.   else {
  668.     set %.topic $readini [ [ $_ppdir ] $+ ] helps.ini help $remove($1,/)
  669.     if (%.topic == c) winhelp peacepro.hlp $remove($1,/) command
  670.     elseif (%.topic != $null) winhelp peacepro.hlp $remove($1,/)
  671.     else help $remove($1-,/)
  672.   }
  673. }
  674. ziplog _askyn _ziplog Make a .zip of all log files?
  675. _ziplog {
  676.   set %.zipper $_ppcfg(misc,winzip)
  677.   if (%.zipper == $null) _error Location of WinZip not defined in CONFIG.INI. Type /findzip to locate WinZip.
  678.   if ($_not($exists(%.zipper)))  _error WinZip has moved or been deleted. Type /findzip to locate WinZip.
  679.   set %.ln $findfile($logdir,*.log,1)
  680.   if (%.ln == $null) _error No log files found to WinZip
  681.   run %.zipper $logdir $+ *.log
  682. }
  683. tome if ($window(@Whois) != $null) window -ar @Whois | else { open @Whois | window -r @Whois }
  684. auth {
  685.   if ($1 == $null) _quickhelp /auth
  686.   set %.a.nick $_nickglob($1)
  687.   if (%.a.nick == $me) _error Don't add yourself to the userlist, it's unneeded and will only cause problems.
  688.   if (($_ismask($1) == $false) && ($address(%.a.nick,5) == $null)) _lookup %.a.nick ! auth , $2-
  689.   if (* isin $1) set %.a.addr $1
  690.   else {
  691.     if (@ !isin %.a.nick) set %.a.nick $address(%.a.nick,5)
  692.     set %.a.addr $maddress(%.a.nick)
  693.     if (%.a.addr == $null) set %.a.addr $_ppmask(%.a.nick,3)
  694.   }
  695.   lvl %.a.addr +send -q | lvl %.a.addr +chat -q
  696.   if ($2 == $null) set %.a.time 5 | else set %.a.time $2
  697.   dispa %col.target $+ %.a.addr $+  has authorization to send you files and DCC chat you for the next  $+ %.a.time $+  minutes.
  698.   .timerDauth [ $+ [ $replace($replace(%.a.addr,*,&),?,+) ] ] 1 $calc(%.a.time * 60) _unauth %.a.addr
  699. }
  700. _unauth lvl $1 -send -q | lvl $1 -chat -q | disps Authorization for files and DCC chats from %col.target $+ $1 $+  has expired.
  701.